package com.github.pig.nideshop.controller.user;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.github.pig.common.util.ZyResult;
import com.github.pig.nideshop.entity.NideshopCategory;
import com.github.pig.nideshop.service.INideshopCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  分类控制器
 * </p>
 * 类别控制器
 * @author J神
 * @since 2018-06-11
 */
@RestController
@RequestMapping("/categorys")
public class NideshopCategoryController {
    @Autowired
    private INideshopCategoryService nideshopCategoryService;

    /**
     * 获取产品类型
     * @param nideshopCategory
     * @return
     */
    @GetMapping
    public Object category(NideshopCategory nideshopCategory){
        EntityWrapper entityWrapper=new EntityWrapper();
        entityWrapper.eq("is_show","1");
        entityWrapper.eq("parent_id",nideshopCategory.getParentId());
        return ZyResult.ok(nideshopCategoryService.selectList(entityWrapper));
    }
}

